package browser;

import com.example.android.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

public class ExemploCheckRadio extends Activity implements OnClickListener {

	EditText textNome;
	Button bt;
	RadioGroup radioConcordodaGroup;
	RadioButton radioConcordaButton;
	CheckBox cbRecebeEmail;

	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.check_radio_form);
		textNome = (EditText) findViewById(R.id.textNome);
		bt = (Button) findViewById(R.id.buttonEnviar);
		bt.setOnClickListener(this);
		radioConcordodaGroup = (RadioGroup) findViewById(R.id.group1);
		cbRecebeEmail = (CheckBox) findViewById(R.id.checkReceberEmail);

	}

	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		int selectedId = radioConcordodaGroup.getCheckedRadioButtonId();
		radioConcordaButton = (RadioButton) findViewById(selectedId);
		Toast.makeText(
				this,
				"Nome:" + textNome.getText().toString() + "\n Concorda:"
						+ radioConcordaButton.getText().toString()
						+ "\n Receber Email:" + cbRecebeEmail.isChecked(),
				Toast.LENGTH_SHORT).show();

	}

}
